﻿ 

@using DevelopmentKit.Extensions.MvcContrib
@using MvcContrib.UI.Pager
@model MvcContrib.Pagination.IPagination<DevelopmentKit.Domain.Right>
@{
    ViewBag.Title = "权限列表";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
 
@using (Html.BeginForm("Index", "Right", FormMethod.Get))
{
    <table class="table_input">
        <tr>
           <th style="width: 80px;">关键字:</th>
            <td style="width: 150px;">@Html.TextBox("keyword", "", new {@class = "text-medium", style = "width: 80%;"})</td>
            <td>
                <input type="submit" class="button-submit" value="查询" />
                @Html.ActionLinkEx("新建", "Create", "Right", new {returnUrl = Request.RawUrl}, new {})</td>
        </tr>
    </table>
}
@if (Model != null && Model.Any())
{
    <table class="table_list">
        <tr>
            <th style="width: 80px;">权限名称</th>  
            <th style="width: 80px;">类别</th> 
            <th>备注</th>
            <th style="width: 120px;">更新时间</th>
            <th style="width: 120px;">操作</th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td>@item.Name</td>
                  <td>@item.Category</td>
                <td>@item.Remark</td>
                <td>@item.Modified</td> 
                <td class="action">    
                    @Html.ActionLinkEx("修改", "Edit", "Right", new {id = item.Id, returnUrl = Request.RawUrl}, new {@class = ""})  
                    @Html.ActionLinkEx("删除", "Delete", "Right", new {id = item.Id}, new {@class = "delete",onclick="document.forms['delete_"+item.Id+"'].submit();return false;"})
                        <form action="@Url.Action("Delete","Right",new{id=item.Id})" name="delete_@item.Id" method="POST">
                        @Html.AntiForgeryToken()
                        @Html.Hidden("returnUrl",Request.RawUrl)
                    </form>        
                </td>
            </tr>
        }


    </table>
    <div class="page">
        @Html.Pager(Model)
    </div>
}
else
{
    <div class="empty">
        查询信息为空
    </div>
}
@section Scripts {
    <script type="text/javascript">

        $(function() {
            $("a.delete").click(function() {
                return window.confirm("您确认要" + $(this).html() + "当前用户么?");

            });

        })

    </script>

}
